import { http } from '@/api';
import { PORT1 } from '@/api/config/port';
import { Dashboard } from '../interface/dashboard';

// dashboard 数据查询
export const Search = (params: { source: string; entityId: string }) => {
  return http.get<Dashboard>(PORT1 + `/admin/dashboard/stat`, params);
};

// top10Assignees
export const Top10Assignees = (params: {
  year: string;
  month: string;
  source: string;
  entityId: string;
}) => {
  return http.get<Dashboard['top10Assignees']>(
    PORT1 + `/admin/dashboard/assignees`,
    params
  );
};

// top5Entities
export const Top5Entities = (params: {
  year: string;
  month: string;
  source: string;
  entityId: string;
}) => {
  return http.get<Dashboard['top5Entities']>(
    PORT1 + `/admin/dashboard/entities`,
    params
  );
};

// ComplainantRoles
export const ComplainantRoles = (params: {
  year: string;
  month: string;
  source: string;
  entityId: string;
}) => {
  return http.get<Dashboard['complainantRoles']>(
    PORT1 + `/admin/dashboard/roles`,
    params
  );
};

// top5Source
export const Top5Source = (params: {
  year: string;
  month: string;
  source: string;
  entityId: string;
}) => {
  return http.get<Dashboard['top5Source']>(
    PORT1 + `/admin/dashboard/sources`,
    params
  );
};

// violationStatus
export const ViolationStatus = (params: {
  year: string;
  month: string;
  source: string;
  entityId: string;
}) => {
  return http.get<Dashboard['violationStatus']>(
    PORT1 + `/admin/dashboard/status`,
    params
  );
};

// top5ViolationTypes
export const Top5ViolationTypes = (params: {
  year: string;
  month: string;
  source: string;
  entityId: string;
}) => {
  return http.get<Dashboard['top5ViolationTypes']>(
    PORT1 + `/admin/dashboard/types`,
    params
  );
};
